import request from '@/utils/request'
import API from './constants'

// 手机号登录
export const getCode = phone => request({
  url: API.CODE_API.replace('{phone}', phone),
  method: 'GET',
})

// 账号密码登录
export const login = ({ phone, code }) => request({
  url: API.LOGIN_API,
  method: 'POST',
  data: { // POST 请求在请求主体中传递数据，使用 data
    phone,
    code,
  },
})
